<?php


namespace App\service\Order;


use App\Models\GrGood;

class ReduceStock
{
    public static function reduceStock($num,$goods_id){
        $data=GrGood::where('goods_id',$goods_id)->fist()->toArray();
        $newNumber=$data['stock_total']-$num;
        $res=GrGood::where('goods_id',$goods_id)->update(['stock_total'=>$newNumber]);
        return $res;
    }
}
